package com.smmisia.shop.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum BusinessEnum {

    /**
     * 0正常经营,1休息,2封禁
     */
    NORMAL(0,"正常经营"),
    REST(1,"休息"),
    BANNED(2,"封禁");

    @EnumValue
    private final Integer code;
    private final String desc;
    BusinessEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BusinessEnum getEnum(Integer code){
        for (BusinessEnum businessEnum : BusinessEnum.values()) {
            if (businessEnum.getCode().equals(code)){
                return businessEnum;
            }
        }
        return null;
    }
}
